import type { ComponentsConfig, ComponentsConfigRaw } from '../../types'
import { extendSchemas } from '@/components/cms/utils'
import advsConfig from './base/advs'
import { briefIntroduction, participatingWorks } from './simples'

const basePath = 'template.actorDetails'
const config: ComponentsConfig = {
  default: 'briefIntroduction',
  components: extendSchemas<ComponentsConfigRaw>(
    {
      briefIntroduction: briefIntroduction({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          maxLine: `${basePath}.content.synopsis.maxLine`,
          background: `${basePath}.content.synopsis.background`,
          moreButton: {
            enable: `${basePath}.content.synopsis.moreButton.enable` as unknown as boolean,
            style: `${basePath}.content.synopsis.moreButton.style`
          }
        }
      }),
      participatingWorks: participatingWorks({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          layout: {
            style: `${basePath}.content.works.layout.style`,
            limit: `${basePath}.content.works.layout.limit`
          }
        }
      })
    },
    advsConfig(['playerBeforeAdv', 'playerPauseAdv'])
  )
}
export default config
